import { ADD, MINUS } from '../types'
function reducer(state, action) {
  state = state || {
    count: 100
  }
  switch (action.type) {
    case ADD:
      return {
        ...state,
        count: state.count + action.num
      }
    case MINUS:
      return {
        ...state,
        count: state.count - action.num
      }
    default:
      return {
        ...state
      }
  }
}

export default reducer